<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>painless脚本语言 | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'modules-scripting-painless.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/modules-scripting-painless.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/modules-scripting-painless.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/modules-scripting-painless.html" rel="nofollow" target="_blank">../en/modules-scripting-painless.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch 权威指南 [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="modules-scripting.html">脚本</a></span>
»
<span class="breadcrumb-node">painless脚本语言</span>
</div>
<div class="navheader">
<span class="prev">
<a href="modules-scripting-security.html">« 脚本与安全</a>
</span>
<span class="next">
<a href="modules-scripting-expression.html">Lucene表达式语言 »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="modules-scripting-painless"></a>painless脚本语言
</h2>
</div></div></div>
<p>
<em>painless</em>是一种简单、安全的脚本语言，专门设计用于Elasticsearch。

它是Elasticsearch的默认脚本语言，可以安全地用于内联和存储的脚本。

要开始学习 painless，请参考<a href="https://www.elastic.co/guide/en/elasticsearch/painless/7.7/painless-guide.html" class="ulink" target="_top">painless指南</a>。

有关 painless 语法和语言特性的详细描述，请参见<a href="https://www.elastic.co/guide/en/elasticsearch/painless/7.7/painless-lang-spec.html" class="ulink" target="_top">painless语言规范</a>。
</p>
<p>
<a id="painless-features"></a>你可以在任何可以在Elasticsearch中使用脚本的地方使用 painless。

painless 提供了：
</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
快速性能：painless 脚本的运行速度<a href="https://benchmarks.elastic.co/index.html#search_qps_scripts" class="ulink" target="_top">比替代方案快几倍</a>。
</li>
<li class="listitem">
安全：具有方法调用/字段粒度的细粒度 允许列表(allowlists)。

有关可用类和方法的完整列表，请参见<a href="https://www.elastic.co/guide/en/elasticsearch/painless/7.7/painless-api-reference.html" class="ulink" target="_top">painless API参考</a>。
</li>
<li class="listitem">
可选类型：变量和参数可以使用显式类型或动态<code class="literal">def</code>(定义)类型。
</li>
<li class="listitem">
语法：扩展Java语法的子集，以提供额外的脚本语言特性。
</li>
<li class="listitem">
优化：专为Elasticsearch脚本设计。
</li>
</ul>
</div>
<p>
准备好开始编写 painless 脚本了吗？请参阅<a href="https://www.elastic.co/guide/en/elasticsearch/painless/7.7/painless-guide.html" class="ulink" target="_top">painless指南</a>然后学习<a href="https://www.elastic.co/guide/en/elasticsearch/painless/7.7/index.html" class="ulink" target="_top">painless脚本语言</a>。
</p>
</div>
<div class="navfooter">
<span class="prev">
<a href="modules-scripting-security.html">« 脚本与安全</a>
</span>
<span class="next">
<a href="modules-scripting-expression.html">Lucene表达式语言 »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>